using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace Main.admin
{
    public partial class EditUser : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.RequestType == "POST")
            {
                MessageLabel.Text = "Is a POST";
                writeUserFields();
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
        }
        protected void writeUserFields()
        {
            String UserName = "";
            String tableHTML = "";
            UserName = Request["user"];
            if ((UserName == null) || (UserName == ""))
                Response.Redirect("Default.aspx");

            DataTable UserTable = DataAccess.GetUserByUserName(UserName);
            foreach (DataRow row in UserTable.Rows)
            {
                tableHTML += "UserName | AppID | UserID | UserName | LoweredUserName | LastActivityDate | IsAnon<br />";

                tableHTML += (String)row["UserName"];
                UserNameTextBox.Text = (String)row["UserName"];
                tableHTML += (Guid)row["ApplicationID"];
                ApplicationIDTextBox.Text = ((Guid)row["ApplicationID"]).ToString();
                tableHTML += (Guid)row["UserID"];
                tableHTML += (String)row["UserName"];
                tableHTML += (String)row["LoweredUserName"];
                // StatusLabel.Text += (String)row["MobileAlias"];
                tableHTML += (DateTime)row["LastActivityDate"];
                tableHTML += (Boolean)row["IsAnonymous"];
                tableHTML += "<br />";
            }
            TableArea.InnerHtml = tableHTML;
        }
    }
}
